/*
 * Copyright (C) 2025 Tsingteng MicroSystem
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @file nfa_utils.c
 * @brief 对外提供的工具函数实现
 */

#include "nfa_utils.h"
#include "nfc_osi_api.h"

/**
 * @brief 释放tNCI_RSP结构体
 *
 * @param rsp tNCI_RSP结构体指针
 * @param only_free_data 是否只释放rsp->data，不释放rsp本身
 */
void nfa_utils_free_rsp(tNCI_RSP *rsp, bool only_free_data) {
    if (!rsp) {
        return;
    }
    if (rsp->data) {
        osi_free(rsp->data);
    }
    rsp->data = NULL;
    rsp->len = 0;
    if (only_free_data) {
        return;
    }
    osi_free(rsp);
}
